package com.example.vo

import android.os.Bundle
import android.view.MenuItem
import android.view.View
import androidx.appcompat.app.AppCompatActivity
import com.example.vo.Controller.BaseActivity
import com.example.vo.Fragment.HistoryFragment
import com.example.vo.Fragment.MainFragment
import com.google.android.material.bottomnavigation.BottomNavigationView


class MainActivity : BaseActivity() {
//    private var listener = object : BottomNavigationView.OnNavigationItemSelectedListener {
//        override fun onNavigationItemSelected(item: MenuItem): Boolean {
//            when(item.itemId){
//                R.id.nav_home -> {
//                    val manager = supportFragmentManager
//                    val transaction = manager.beginTransaction()
//                    transaction.replace(R.id.nav_host_fragment, MainFragment()).commit()
//                }
//                R.id.nav_history -> {
//                    val manager = supportFragmentManager
//                    val transaction = manager.beginTransaction()
//                    transaction.replace(R.id.nav_host_fragment, HistoryFragment()).commit()
//                }
//            }
//            return true
//        }
//    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        val manager = supportFragmentManager//设置BottomNavigation的首页面
        val transaction = manager.beginTransaction()
        transaction.replace(R.id.nav_host_fragment, MainFragment()).commit()
//
//        val navViewtop: BottomNavigationView = findViewById(R.id.nav_view_top)//载入BottomNavigation
//        navViewtop.setItemIconTintList(null)
//        navViewtop.setOnNavigationItemSelectedListener(listener)//为BottomNavigation导航栏设置点击事件
//        val item_main:View = findViewById(R.id.nav_home)
//        val item_histort:View = findViewById(R.id.nav_history)
//        item_main.setOnLongClickListener { false }
//        item_histort.setOnLongClickListener { false }
    }
}